package com.lzhsite.technology.designPattern.factory.TextImageReadDemo;

/**
 * 类描述：图像信息
 * 
 * @author: Jing
 * @version $Id: Exp$
 * 
 * History: Dec 18, 2014 4:31:28 PM Jing Created.
 * 
 */
public class ImageInfo {
	/**
	 * 图像宽度
	 */
	private int width;
	/**
	 * 图像高度
	 */
	private int height;
	/**
	 * 红色分量
	 */
	private int r[][];
	/**
	 * 绿色分量
	 */
	private int g[][];
	/**
	 * 颜色分量
	 */
	private int b[][];

	/**
	 * 
	 * 方法说明：设置三基色信息
	 * 
	 * Author： Jing Create Date： Dec 18, 2014 4:33:51 PM
	 * 
	 * @param rgb
	 * @return void
	 */
	public void setRGB(int rgb[]) {

		r = new int[height][width];
		g = new int[height][width];
		b = new int[height][width];

		int pos = 0;
		for (int i = 0; i < height; i++) {

			pos = width * i;
			for (int j = 0; j < width; j++) {

				r[i][j] = (rgb[pos + j] & 0xff0000) >> 16;
				g[i][j] = (rgb[pos + j] & 0xff0000) >>8;
				b[i][j] = (rgb[pos + j] & 0xff0000);
			}
		}
	}

	/**
	 * @return the width
	 */
	public int getWidth() {
		return width;
	}

	/**
	 * @param width
	 *            the width to set
	 */
	public void setWidth(int width) {
		this.width = width;
	}

	/**
	 * @return the height
	 */
	public int getHeight() {
		return height;
	}

	/**
	 * @param height
	 *            the height to set
	 */
	public void setHeight(int height) {
		this.height = height;
	}
	/**
	 * @return the r
	 */
	public int[][] getR() {
		return r;
	}
	/**
	 * @param r
	 *            the r to set
	 */
	public void setR(int[][] r) {
		this.r = r;
	}
	/**
	 * @return the g
	 */
	public int[][] getG() {
		return g;
	}
	/**
	 * @param g
	 *            the g to set
	 */
	public void setG(int[][] g) {
		this.g = g;
	}
	/**
	 * @return the b
	 */
	public int[][] getB() {
		return b;
	}
	/**
	 * @param b
	 *            the b to set
	 */
	public void setB(int[][] b) {
		this.b = b;
	}
}
 